package util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.ResourceBundle;


public class PropUtil {

	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("my");

	public static String getPropValue(String propName) throws IOException{
	    Logger.debug("start getPropValue");
		InputStream  inStream = PropUtil.class.getClassLoader()
                .getResourceAsStream("my.properties");
		Properties properties=new Properties();
		properties.load(inStream);
		String propValue = properties.getProperty(propName);
		//String propValue = RESOURCE_BUNDLE.getString(propName);
		Logger.debug("end getPropValue "+propName,propValue);
		return propValue;
		
	}
	public static String getPropValueByResourceBundle(String propName) throws IOException{
		Logger.debug("start getPropValue");
		//String propValue = properties.getProperty(propName);
		String propValue = RESOURCE_BUNDLE.getString(propName);
		Logger.debug("end getPropValue "+propName,propValue);
		return propValue;

	}
	
	public static void main(String args[]) throws IOException{
		
		String port=PropUtil.getPropValue("port");
		String ports=PropUtil.getPropValueByResourceBundle("port");

		
	}
	

}
